import * as echarts from 'echarts'

export default function useEcharts(el) {
//创建echarts实例
  const echartsInstance = echarts.init(el)
//设置options
  const setOptions = (options) => {
    echartsInstance.setOption(options, true)
  }
//监听窗口变化做自适应
  const resize = () => {
    echartsInstance.resize()
  }
  return {
    echartsInstance,
    setOptions,
    resize
  }
}
